﻿Module Module1
    Function Bai01(ByVal n As Integer) As Integer
        Dim S As Integer = 0
        Dim i As Integer
        For i = 0 To n Step 1
            S = S + i
        Next
        Return S
    End Function
    Sub Main()
        Dim n As Integer
        Console.WriteLine("Nhap So n: ")
        n = Console.ReadLine()
        Dim kq As Integer = 10
        kq = Bai01(n)
        Console.WriteLine("S(n)= " & kq)
    End Sub

End Module
